package com.ytzl.itrip.trade.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String APPID = "2016091600525844";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String RSA_PRIVATE_KEY = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCq9gpq/mdaWNlcwgnn2eu56HA1SBbmZyN9dN0Vm4sqkCgU/SV1h67HiQ7aAuZCtIut1u9Zi6Pqhzu5QdemcTrMfEupk/hk+PKbCzdtWETYTRXJWmWaxR9sP+3hXOIXPOgr300maynGdsxaufAtw5yTmpZtf8gjD4MSWQnmcOns7I6qVlOEj4v1gXa4KCucRNTSCoqcutJSZ0Pn9vKgZGVxFEOd0e28HwMdvd9CbC6N0toqFPYzbVnBqTNg6mKdF0GsSODn6e5RA+H3LGf1c4Pg/rETAu/ML4giFsMqYXWRuy0wnsZiXsZBHWOqE0SdiSVhx4GRXdM/0Wel5cKh5/TvAgMBAAECggEBAKf6vN3IPrENH/X+SlFfVDkE5EvWG3oj2UFJ9HloreMSZe/JlGbY/KjeSJN5ydm9IImc6OzpQhQM8GflBAlstEN71bQ3yhccbPRenwV3d524kDGZ+r+J9IgegJOw+g2vMMj6zglzvkZdMAntLMsqqsx1Vl0c8v9QHI+IoSulwpOheFh7e2eMAsS8EasAZ7408i4pB7w0FbZJQB/hoXotThCKgv9KkWn7jhbTesM8nXnIumw85roCMv/4Ev1CW5/59uhe5ZwLy0LRuupRlidkgkdi2hq82fvS3oOCdYU/9X0NbIo9iBzhYR9ETls7OHMEJ3A/VQd8WSVJykxNdj3lCRECgYEA2W6jvCK9bVePcLLBkov5iqfLuLL1S4SQcsUkS6rdUNndprc4GotZ/YVv5I8LShS8dPE+vK0GJlnLmlYA88ANyBhxr+0OTr6T12hXEIWZUlU61DIxCTwXQSNRVRCZJ1HZBhdQ60sKvlmif0q3ANy2B/2YGBBYsTHDJHQM7QL03/MCgYEAyUky/knZxnPnpVL4j3LJ+u+0dtIueQwZmJ+Xe6aF3OsD3wGxHFyhuAnzYPLIW07NkB01qEeP8iiidD9waBZ6HzRbcPVRgiSK0ECwPXT6ZYfE6AsJRNX3HLXCwyuQJPrE7SEKS1mym86ej97denzA2XS6cGsLutoJRVdUR8LDkhUCgYAiAn9T7y8oCjkijKNgk8ptmL9x3XQm4s5hVVrPByPlAJ7988yvwjpKQHP3ETTX2pR7yjxg8MN0fjkto+Q0PEcrlD88IF1Ljd28JNLxf6Qyz6gLBurKof6VLrwLDTSXhOLoY/9BPpSon4aeWIZ1eRB0AYOnx+7HkJwQeKKI9BxvZwKBgQCSgKiQ1IehHbM4bU9keRPxhI5A/XG9wMTQhTfoU6eSx6sloUGbdwBtxzBRG+QgMRcFEX2AYbWvd0vmeFYELHfuRllXufX9V0OBl9Oup3modE0o5v90DpexWcnL6+UaRTsXrLilZz/Mj3JxHLDu+eYTYBZixEbhVNjyk0FQib12kQKBgQCTdMKIR9GAp9aJyJJSUwWLaMikF5nZIiGSOimZ4KUxVcH1m2zctlpbDNBovDEE5tdZPxrtOhb6BF2SW494fQXJCLtl3Dsx66PsfONPq95EFnFSDaUrc4oQ5oYKMQ1xLrF9uHr3bwGrHCDF8W/ZGoNpR5jK7kReBKT8lGDRFe0oGg==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwrcGm4OAsZBHhE2gIww9tHcF1mTkIw19JlcrMypcj+zdD8OcyITqL9UIVFTmy+QRrx6QNxCpOUQsvVJjDMOTezIJA8WZccW36ludh9OYsbrDHN7c8QH0PkKZVyaNgSqH/L1Ya7J9mc0ZUcbCrrGLk6ALjfZcKbnDV6HUuZRg0BtBjAnbPtL1FjtBjzZnhyEkAmI9fQRMvmhOH6gI13kxP/xDFkoAf+UedTCth65g9UclCZrCm+IWf7IpA1kNR1S+IOEjwJeNqJzZE2dWwrUMg4PTNJV6oxra4TCAeKZDEd8zfJUM3rZtSZj56zZrxJ5mVSUKlViN1orNQODm3Tt4ewIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/trade/api/notifyurl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/trade/api/return";

    // 签名方式
    public static String SIGNTYPE = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 返回格式
    public static String FORMAT = "json";

    // 支付宝网关
    public static String URL = "https://openapi.alipaydev.com/gateway.do";

    // 错误日志输出文件夹
    public static String log_path = "E:\\log";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

